import Vue from 'vue'
import VueRouter, { RouteConfig, Route } from 'vue-router'
import routerItems from './router'

Vue.use(VueRouter)

/* const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location: RouteConfig) {
  return originalPush.call(this, location).catch((err: any) => err)
} */

const routes: RouteConfig[] = [...routerItems]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

router.beforeEach((to, from, next) => {
  next()
})
router.afterEach((to, from) => {
  // ...
})
export default router
